fn main() {
    print();

    println!("5 + 6 = {}", add(5, 6));

    let (res1,res2) = sub(5,6);

    println!("5 + 6 = {}, 5 - 6 = {}", res1, res2);

    let a :i32 = {
        let b = 6;
        b * 2 
    };

    println!("a = {}", a);

}

fn print() {
    println!("Hello, world");
}

//返回值必须明确声明类型，不能自动推导
//可以返回多个值
fn add(x :i32,y :i32) -> i32 {
    //return x + y;
    x + y
}

//rust函数不支持返回多个值
//可以使用元组进行返回多个值的操作，但是实际上仍旧是返回了一个值
fn sub(x: i32 , y: i32) -> (i32, i32){
    (x + y , x - y)
}
